#ifndef CHESSBOARD_H
#define CHESSBOARD_H

#include <vector>
#include <QPoint>
#include <QWidget>
#include "Chess.h"
#include "ChessBoardImp.h"

class ChessBoard{
public:
    ChessBoard(){}

    ChessBoard(ChessBoardImp* imp):_imp(imp){
        _chessBoardWidth = _imp->getAttribute("blockWidthNum");
        _chessBoardLength = _imp->getAttribute("blockHeightNum");
        isNew = false;
    }

    std::vector< std::vector<Chess*> >* getChessBoardInstance();
    int getChessBoardWidth();
    int getChessBoardLength();
    QPoint getPosition();
    virtual void setPressedPoint(QPoint);
    virtual ChessBoardImp* getChessBoardImp(){
        return _imp;
    }
    virtual Chess* getChess(QPoint);
    virtual void MoveChess(QPoint,QPoint);
    virtual void saveState();
    virtual void undo();

    //pure virtual function, subclass must implement
    virtual void setChess(QPoint,std::string)=0;
    virtual void cleanChess(QPoint);
    virtual void initialBoard()=0;
    virtual void resetChessBoard()=0;
    ~ChessBoard(){}
protected:
    std::vector< std::vector<Chess*> > _chessBoard;
    std::vector< std::vector< std::vector<Chess*> >* > _chessBoardState;
    int _chessBoardWidth;
    int _chessBoardLength;
    bool isNew;
    QPoint point;
    ChessBoardImp* _imp;



};

#endif // CHESSBOARD_H
